/*
 * AccessControlElement.java
 *
 * Created on July 24, 2006, 2:21 PM
 *
 * @author Francois Daniels
 */

package za.gateway.container;

/**
 * This class will store data regarding elements of the access control 
 * list. It will store data such as the name of the group, the 
 * restriction and the phone number on which this restriction is 
 * applied.
 *
 * @author Francois Daniels
 */
public class AccessControlElement {
    /** Variables belonging to the AccessControlElement class */
   
    /** 
     * This is the name of the group to which this access control 
     * element is applied.
     */
    protected String GroupName;
    
    /** 
     * This is the name of the restriction which is to be applied to 
     * the given phone number for this group.
     */
    protected String RestrictionName;
    
    /** 
     * This is the number onto which to apply the restriction.
     */
    protected String PhoneNumber;
    
    /** 
     * This is set to true when this object has been modified since 
     * creation.
     */
    protected boolean Dirty;
    
    
    /** Functions belonging to the AccessControlElement class */
    
    /**
     * Create a new instance of the AccessControlElement.
     * @param GroupNameData         This is the name of the group to 
     *                              which this access control element 
     *                              is applied.
     * @param RestrictionNameData   This is the name of the restriction 
     *                              which is to be applied to the given 
     *                              phone number for this group.
     * @param PhoneNumberData       This is the number onto which to 
     *                              apply the restriction.
     */
    public AccessControlElement (   String GroupNameData, 
                                    String RestrictionNameData,
                                    String PhoneNumberData) {
        GroupName           = GroupNameData;
        RestrictionName     = RestrictionNameData;
        PhoneNumber         = PhoneNumberData;
        Dirty               = false;
    }
    
    /**
     * This function is used to update the details for an 
     * AccessControlElement
     *
     * @param GroupNameData         This is the name of the group to 
     *                              which this access control element 
     *                              is applied.
     * @param RestrictionNameData   This is the name of the restriction 
     *                              which is to be applied to the given 
     *                              phone number for this group.
     * @param PhoneNumberData       This is the number onto which to 
     *                              apply the restriction.
     */
    public void SetData (   String GroupNameData, 
                            String RestrictionNameData,
                            String PhoneNumberData) {
        GroupName           = GroupNameData;
        RestrictionName     = RestrictionNameData;
        PhoneNumber         = PhoneNumberData;
        Dirty               = true;
    }
    
    /**
     * Returns the group name to which the access control element 
     * applies.
     *
     * @return the group name to which the access control element 
     * applies.
     **/
    public String GetGroupName () {
        return GroupName;
    }
    
    /**
     * Returns the name of the restriction which has been placed on 
     * this access control element.
     *
     * @return The name of the restriction which has been placed on 
     * this access control element.
     **/
    public String GetRestrictionName () {
        return RestrictionName;
    }
   
    /**
     * Returns the phone number on which this access control element 
     * has been applied.
     *
     * @return The phone number on which this access control element 
     * has been applied.
     */
    public String GetPhoneNumber () {
        return PhoneNumber;
    }
    
    /**
     * This function will determine whether or not this object has been
     * modified since it has been created.
     *
     * @return true if it has been modified since creation, false 
     * otherwise.
     **/
    public boolean IsDirty () {
        return Dirty;
    }
    
    
}
